home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 July
/
EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso
/
earkit
/
news
/
thor
/
rexx
/
bbsread
/
forwardmsg.br
< prev
next >
Wrap
Text File
|
1998-05-24
|
3KB
|
127 lines
/*
** $VER: ForwardMsg.thor 1.0 (13.5.97)
** by Eirik Nicolai Synnes
**
*/
options results
options failat 31
parse arg arguments
template = 'SYSTEM/A,CONFERENCE/A,MSGNO/A/N,TO/A'
/*
** INITIALIZATION
*/
EVE_ENTERMSG = 0 /* Enter message */
EVE_REPLYMSG = 1 /* Reply message */
EVE_FORWARDMSG = 9 /* Forward message (only TCP/SOUP) */
MDB_URGENT = 11 /* Message is urgent. */
MDB_RETURNRECEIPT = 26
MDB_ENCODE8BIT = 27
/*
** Check if BBSREAD's ARexx port is open, open it if it's not
*/
if ~(show('P', 'BBSREAD')) then do
address(command)
'Run >NIL: `GetEnv THOR/THORPath`bin/LoadBBSRead'
if exists('SYS:RexxC/WaitForPort') then 'SYS:RexxC/WaitForPort BBSREAD'
else 'WaitForPort BBSREAD'
if (rc = 5) then do; say 'Could not open BBSREAD''s ARexx port.'; exit(30); end
if (rc ~= 0) then do; say 'Could not find SYS:Rexxc/WaitForPort.'; exit(30); end
end
/*
** Parse command line
*/
if (arguments = '') | (arguments = '?') then do
say 'Template: 'template
say 'BounceMsg.br is an external script for SortMail.'
exit(20)
end
address(bbsread)
'READARGS 'template args' CMDLINE 'arguments
if (rc ~= 0) then do
say 'Template: 'template
say 'READARGS failed: 'BBSREAD.LASTERROR
exit(rc)
end
/*
** Get message data
*/
'READBRMESSAGE "'args.SYSTEM'" "'args.CONFERENCE'" 'args.MSGNO' DATASTEM 'msgdata' HEADSTEM 'msghead
if (rc ~= 0) then do
say 'READBRMESSAGE, data & head stem: 'BBSREAD.LASTERROR
exit(rc)
end
/*
** Get addresses to mail message to and create event data
*/
if (index(args.TO, '@') > 0) then do
eventdata.TONAME = ''
eventdata.TOADDR = args.TO
end
else do
'SEARCHBRUSER "'args.SYSTEM'" STEM 'user' SEARCH "'args.TO'" NAME'
if (rc ~= 0) then do
say 'SEARCHBRUSER: 'BBSREAD.LASTERROR
exit(rc)
end
if (result = 0) then do
say 'No user with the name "'args.TO'".'
exit(20)
end
'READBRUSER BBSNAME "'args.SYSTEM'" USERNR 'user.1.USERNR' TAGSSTEM 'usertags' DATASTEM 'userdata
if (rc ~= 0) then do
say 'READBRUSER: 'BBSREAD.LASTERROR
exit(rc)
end
if (symbol('usertags.ADDRESS') ~= 'VAR') | (strip(usertags.ADDRESS, 'B') = '') then do
say 'User "'args.TO'" does not have any addresses defined.'
exit(20)
end
eventdata.TONAME = usertags.NAME
eventdata.TOADDR = usertags.ADDRESS
end
eventdata.SUBJECT = msghead.SUBJECT || ' (fwd)'
eventdata.CONFERENCE = 'EMail'
eventdata.REFCONFERENCE = args.CONFERENCE
eventdata.REFNR = args.MSGNO
if (symbol('msghead.MSGID') = 'VAR') then eventdata.REFID = msghead.MSGID
/*
** Write the new event
*/
'WRITEBREVENT BBSNAME "'args.SYSTEM'" EVENT 'EVE_FORWARDMSG' STEM 'eventdata
if (rc ~= 0) then do
say 'WRITEBREVENT: 'BBSREAD.LASTERROR
exit(rc)
end
exit(0)